<template>
  <div class="text">
    <template v-if="(setupOption.imageUrl && isPreview) || !isPreview">
      <a
        v-if="setupOption.jumpUrl"
        :href="setupOption.jumpUrl"
        :target="setupOption.jumpMode"
        style="text-decoration: none"
      >
        <img style="width: 100%; height: 100%" :src="setupOption.imageUrl || emptyImg" alt="" />
      </a>
      <img
        v-else
        style="width: 100%; height: 100%"
        :src="setupOption.imageUrl || emptyImg"
        alt=""
      />
    </template>
  </div>
</template>

<script setup lang="ts">
import { computed } from 'vue'
import emptyImg from '@/assets/images/tools/img.png'

// Props
const props = defineProps<{
  widgetOptions: any
  isPreview?: Boolean
}>()

const emit = defineEmits([])

const setupOption = computed(() => {
  return props.widgetOptions.setup
})
</script>

<style scoped lang="scss">
.text {
  width: 100% !important;
  height: 100% !important;
}
</style>
